Ext.setup({
	icon : 'img/icon.png',
	tabletStartupScreen : 'img/tablet_startup.png',
	phoneStartupScreen : 'img/phone_startup.png',
	glossOnIcon: false,
    onReady: function() {
		var form;
		
		var formBase = {
            scroll: 'vertical',
            url   : './basic/LoginController/login.action',
            standardSubmit : false,
            items: [
            	{
				xtype : 'fieldset',
				title : '欢迎使用4SMS移动版',
				instructions : '请输入用户名和密码',
				defaults : {
					required : true,
					labelAlign : 'left',
					labelWidth : '30%'
				},
				items : [ {
					xtype : 'textfield',
					name : 'staffmember',
					value: 'admin',
					label : '用户名',
					useClearIcon : true,
					autoCapitalize : false
				}, {
					xtype : 'passwordfield',
					name : 'psw',
					value: '000000',
					label : '密码',
					useClearIcon : false
				}]
			}
            ],
            listeners : {
                submit : function(form, result){
                	if(result.result == 'success') {
                		window.location.href = 'mobile/main.html';
                	}
                	else {
                		Ext.Msg.alert('错误', '用户名或者密码错误！', Ext.emptyFn);
                	}
                },
                exception : function(form, result){
                }
            },
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'bottom',
                    items: [
                    	{
                            text: '重置',
                            handler: function() {
                                form.reset();
                            }
                        },
                        {
                            text: '登录',
                            ui: 'confirm',
                            handler: function() {
                                form.submit({
                                    waitMsg : {message:'Submitting', cls : 'demos-loading'}
                                });
                            }
                        }
                    ]
                }
            ]
		}
		
            formBase.fullscreen = true;
        
        form = new Ext.form.FormPanel(formBase);
        form.show();
	}
});